import http from "../utils/http"
import apiApp from "./api-app.js"

let api = {}

//登录
api.login = params => http.post("/api/sys/login/login", params);
//退出登录
api.logout = params => http.post("/api/sys/login/logout", params);

//统一上传文件
api.upFile = params => http.upload("/api/app/file/up", params);

//两级联动
api.sysKgClassList = params => http.get("/api/sys/select/kgClass", params);
//三级联动
api.sysKgClassStuList = params => http.get("/api/sys/select/kgClassStu", params);

//图片管理------
//根据幼儿园id获取班级列表
api.sysClassFindByKgId = kgId => http.get(`/api/sys/class/findAllByKgId/${kgId}`)
//根据班级id获取学生列表
api.sysStudentFindByClassId = classId => http.get(`/api/sys/student/findAllByClassId/${classId}`)

//根据学生姓名获取学生列表
api.sysStudentFindBystuName = studentName => http.get("/api/sys/student/findAllByStuName?studentName="+studentName)
//根据学生id获取学生图片
api.sysPictureFindByStudentId = studentId => http.get(`/api/sys/picture/findByStudentId/${studentId}`)

api.sysPictureEdit = params => http.post("/api/sys/picture/edit", params);

//新增图片
api.sysPictureAdd = params => http.post("/api/sys/picture/add", params);

api.sysPictureDelByIds = ids => http.delete(`/api/sys/picture/delByIds/${ids}`);
//根据id查询照片信息
api.sysPictureFindById = id => http.get(`/api/sys/picture/findById/${id}`);
//根据订单id查看已选照片
api.sysChoosePictureList = billId => http.get(`/api/sys/picture/findChoosePictureList/${billId}`);

//家长管理相关--------
api.sysParentFindAllByPage = params => http.get("/api/sys/parent/findAllByPage", params)
api.sysParentEdit = params => http.post("/api/sys/parent/edit", params)
api.sysParentAdd = params => http.post("/api/sys/parent/add", params);
api.sysParentDelByIds = ids => http.delete(`/api/sys/parent/delByIds/${ids}`);
//根据id查询家长信息
api.sysParentFindById = id => http.get(`/api/sys/parent/findById/${id}`);

//产品管理相关-------
api.sysGoodsFindAllByPage = params => http.get("/api/sys/goods/findAllByPage", params)
api.sysGoodsEdit = params => http.post("/api/sys/goods/edit", params)
api.sysGoodsAdd = params => http.post("/api/sys/goods/add", params);
api.sysGoodsDelByIds = ids => http.delete(`/api/sys/goods/delByIds/${ids}`);
//根据id查询goods信息
api.sysGoodsFindById = id => http.get(`/api/sys/goods/findById/${id}`);




//班级管理---------
api.sysclassFindAllByPage = params => http.get("/api/sys/class/findAllByPage", params)
api.sysclassEdit = params => http.post("/api/sys/class/edit", params)
api.sysclassAdd = params => http.post("/api/sys/class/add", params);
api.sysclassFindAllByList = params => http.get("/api/sys/class/findAllByList", params)
api.sysclassDelByIds = ids => http.delete(`/api/sys/class/delByIds/${ids}`);
//根据id查询班级信息
api.sysclassFindById = id => http.get(`/api/sys/class/findById/${id}`);

//获取班级列表
api.sysclassassFindAllByList = params => http.get("/api/sys/class/findAllByList", params)

//反馈管理----------
api.sysfeedbackFindAllByPage = params => http.get("/api/sys/feedback/findAllByPage", params)
api.sysfeedbackEdit = params => http.post("/api/sys/feedback/edit", params)
api.sysfeedbackAdd = params => http.post("/api/sys/feedback/add", params);
api.sysfeedbackDelByIds = ids => http.delete(`/api/sys/feedback/delByIds/${ids}`);
//获取反馈列表
api.sysfeedbackFindAllByList = params => http.get("/api/sys/feedback/findAllByList", params)
//根据id查询反馈内容
api.sysfeedbackFindById = id => http.get(`/api/sys/feedback/findById/${id}`);

//订单管理----------
api.sysBillFindAllByPage = params => http.get("/api/sys/bill/findAllByPage", params)
api.sysBillEdit = params => http.post("/api/sys/bill/edit", params)
api.sysBillAdd = params => http.post("/api/sys/bill/add", params);
api.sysBillDelByIds = ids => http.delete(`/api/sys/bill/delByIds/${ids}`);
//根据id查询订单信息
api.sysBillFindById = id => http.get(`/api/sys/bill/findById/${id}`);


//幼儿园管理----------
api.sysKgFindAllByPage = params => http.get("/api/sys/kg/findAllByPage", params)
api.sysKgEdit = params => http.post("/api/sys/kg/edit", params)
api.sysKgAdd = params => http.post("/api/sys/kg/add", params);
api.sysKgDelByIds = ids => http.delete(`/api/sys/kg/delByIds/${ids}`);
//获取幼儿园列表
api.sysKgFindAllByList = params => http.get("/api/sys/kg/findAllByList", params)
//根据id查询幼儿园信息
api.sysKgFindById = id => http.get(`/api/sys/kg/findById/${id}`);


//学生管理---------
api.sysStudentFindAllByPage = params => http.get("/api/sys/student/findAllByPage", params)
api.sysStudentEdit = params => http.post("/api/sys/student/edit", params)
api.sysStudentAdd = params => http.post("/api/sys/student/add", params);
api.sysStudentDelByIds = ids => http.delete(`/api/sys/student/delByIds/${ids}`);
//根据id查询学生信息
api.sysStudentFindById = id => http.get(`/api/sys/student/findById/${id}`);
//获取学生列表信息
api.sysStudentFindAllByList = params => http.get("/api/sys/student/findAllByList", params)

//教师管理-----
api.sysTeacherFindAllByPage = params => http.get("/api/sys/teacher/findAllByPage", params)
api.sysTeacherAdd = params => http.post("/api/sys/teacher/add", params);
api.sysTeacherEdit = params => http.post("/api/sys/teacher/edit", params)
api.sysTeacherDelByIds = ids => http.delete(`/api/sys/teacher/delByIds/${ids}`);
//根据id查询教师信息
api.sysTeacherFindById = id => http.get(`/api/sys/teacher/findById/${id}`);

//查询用户列表,获取登录账号
api.sysUserFindAllByList = params => http.get("/api/sys/user/findAllByList", params)

//用户相关-----
api.sysUserFindAllByPage = params => http.get("/api/sys/user/findAllByPage", params)
api.sysUserEdit = params => http.post("/api/sys/user/edit", params)
api.sysUserAdd = params => http.post("/api/sys/user/add", params);
api.sysUserDelByIds = ids => http.delete(`/api/sys/user/delByIds/${ids}`);
//根据id 查询管理员信息
api.sysUserFindById = id => http.get(`/api/sys/user/findById/${id}`);


//获取用户信息
api.sysUserFindProfile = params => http.get("/api/sys/user/findProfile", params);
api.sysUserEditUserProfile = params => http.post("/api/sys/user/edit/profile", params);
//修改密码
api.sysUserEditPassword = params => http.post("/api/sys/user/edit/password", params);
//修改头像
api.sysUserEditAvatar = params => http.post("/api/sys/user/avatar", params);
//重置密码
api.sysUserRePassword = params => http.post("/api/sys/user/rePassword", params);

//菜单相关
api.sysMenuFindAllByTree = params => http.get("/api/sys/menu/findAllByTree", params);
api.sysMenuAdd = params => http.post("/api/sys/menu/add", params);
api.sysMenuEdit = params => http.post("/api/sys/menu/edit", params);
api.sysMenuDelByIds = ids => http.delete(`/api/sys/menu/delByIds/${ids}`, null);
//菜单使用
api.sysMenuFindUserMenuByTree = params => http.get("/api/sys/menu/findUserMenuByTree", params);
api.sysMenuFindSelectByTree = params => {
	if (!params) {
		params = {
			isAll: true
		}
	}
	return http.get("/api/sys/menu/findSelectByTree", params);
}
api.sysMenuFindAllPerByUserId = params => http.get("/api/sys/menu/findAllPerByUserId", params);

//角色相关
api.sysRoleFindAllByPage = params => http.get("/api/sys/role/findAllByPage", params)
//获取所有角色列表信息
api.sysRoleFindAllByList = params => http.get("/api/sys/role/findAllByList", params)
api.sysRoleAdd = params => http.post("/api/sys/role/add", params);
api.sysRoleEdit = params => http.post("/api/sys/role/edit", params);
api.sysRoleDelByIds = ids => http.delete(`/api/sys/role/delByIds/${ids}`, null);

//操作日志
api.sysOperateLogFindAllByPage = params => http.get("api/sys/log/findAllByPage", params)
api.sysOperateLogFindAllByList = params => http.get("api/sys/log/findAllByList", params)
api.sysOperateLogEdit = params => http.post("api/sys/log/edit", params);
api.sysOperateLogAdd = params => http.post("api/sys/log/add", params);
api.sysOperateLogDelByIds = id => http.delete("api/sys/log/delByIds/" + id, null);

Object.assign(api, apiApp)
export default api